// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_c;

import java.io.UnsupportedEncodingException;


public class cls_q
{

    private cls_q()
    {
    }

    public static String a(String s)
    {
        StringBuffer stringbuffer = new StringBuffer();
        int i = 0;
        while(i < s.length()) 
        {
            char c = s.charAt(i);
            if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || ".-*_".indexOf(c) > -1)
                stringbuffer.append(c);
            else
            if(c == ' ')
            {
                stringbuffer.append("%20");
            } else
            {
                char ac[] = new char[1];
                ac[0] = c;
                byte abyte0[] = (new String(ac)).getBytes();
                int j = 0;
                while(j < abyte0.length) 
                {
                    stringbuffer.append('%');
                    stringbuffer.append("0123456789ABCDEF".charAt((0xf0 & abyte0[j]) >> 4));
                    stringbuffer.append("0123456789ABCDEF".charAt(0xf & abyte0[j]));
                    j++;
                }
            }
            i++;
        }
        return stringbuffer.toString();
    }

    public static String a(String s, String s1)
    {
    	String s2 = null;
        if(s != null && s1 != null) {
        	StringBuffer stringbuffer;
            int i;
            int j;
            try
            {
                "".getBytes(s1);
            }
            catch(Exception exception) { }
            stringbuffer = new StringBuffer();
            i = 0;
            j = -1;
            while(i < s.length()) 
            {
                char c = s.charAt(i);
                if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || " .-*_".indexOf(c) > -1)
                {
                    if(j >= 0)
                    {
                        a(s.substring(j, i), stringbuffer, s1);
                        j = -1;
                    }
                    if(c != ' ')
                        stringbuffer.append(c);
                    else
                        stringbuffer.append("%20");
                } else
                if(j < 0)
                    j = i;
                i++;
            }
            if(j >= 0)
                a(s.substring(j, s.length()), stringbuffer, s1);
            s2 = stringbuffer.toString();
        }
 
        return s2;
 
    }

    private static void a(String s, StringBuffer stringbuffer, String s1)
    {
        byte abyte0[]=null;
        int i;
        try {
			abyte0 = s.getBytes(s1);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        i = 0;
while(true)
{
        if(i >= abyte0.length)
            break  ;
        stringbuffer.append("%");
        char c = "0123456789ABCDEF".charAt((0xf0 & abyte0[i]) >> 4);
        char c1 = "0123456789ABCDEF".charAt(0xf & abyte0[i]);
        stringbuffer.append(c);
        stringbuffer.append(c1);
        i++;
}
    }

    public static String b(String s, String s1)
    {
    	String s2 = null;
        if(s != null && s1 != null) {
        	StringBuffer stringbuffer;
            int i;
            int j;
            try
            {
                "".getBytes(s1);
            }
            catch(Exception exception) { }
            stringbuffer = new StringBuffer();
            i = 0;
            j = -1;
            while(i < s.length()) 
            {
                char c = s.charAt(i);
                if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || " .-_~".indexOf(c) > -1)
                {
                    if(j >= 0)
                    {
                        a(s.substring(j, i), stringbuffer, s1);
                        j = -1;
                    }
                    if(c != ' ')
                        stringbuffer.append(c);
                    else
                        stringbuffer.append("%20");
                } else
                if(j < 0)
                    j = i;
                i++;
            }
            if(j >= 0)
                a(s.substring(j, s.length()), stringbuffer, s1);
            s2 = stringbuffer.toString();
        }
 
        return s2;
 
    }

    static final String a = "0123456789ABCDEF";
}
